<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>dom</title>
</head>
<body>
    <div id="a">abc</div>
    <input id="txt" type="text" value="5">
    <button onclick="abc()">click</button>
</body>
<script>
    function abc(){
        //提取div里面内容,输出到控制台
        //1.获取标签元素,赋值给一个变量,标签对象
        //2.使用对象的方法来获取标签里面的内容
        // let div_obj=document.getElementById("a");
        let div_obj=document.querySelector("#a");
        div_obj.innerText="efg";
        console.log(div_obj.innerText)

        let txt_obj=document.querySelector("#txt");
        txt_obj.value=15
        console.log(txt_obj.value);
       
        
    }
</script>
</html>